Skip to content

Conversation

@EzraBrooks
Copy link
Collaborator

Fixes #1069 and a couple other things we hadn't caught yet. (also, validates my instinct that = unknown for type args is a lot less painful for static typing than = undefined, because I had to change some of them from the latter to the former for this to work)

@EzraBrooks

This comment was marked as resolved.

@EzraBrooks EzraBrooks force-pushed the use-enormous-union-type-for-message-types branch from df49a5c to 0183a0d Compare November 14, 2025 16:44
@EzraBrooks EzraBrooks force-pushed the use-enormous-union-type-for-message-types branch from 0183a0d to fb62e70 Compare November 14, 2025 16:51
@EzraBrooks
Copy link
Collaborator Author

of course right after I tell @douglascayers it's not necessary to expose all these types I go and make the types more exhaustive and it turns out I was wrong 😆

@drewhoener
Copy link
Contributor

drewhoener commented Nov 14, 2025

This basically accomplishes a bunch of what I was doing in my other PR so it's fine by me :)

Couple things for consideration maybe?

  • This still doesn't solve the TODO for the deep partial on outgoing + required on incoming for service call operations
  • Part of my rationale with the discriminated union was to avoid having to maintain a guard function for each op, those can probably just go away now, right?
  • Missing types for compression on RosbridgeCallServiceMessage

This also doesn't provide typing for service or action events emitted by the Ros client.
Maybe I could use this as a jumping off point and build off of yours? It accomplishes most of the same stuff

@EzraBrooks
Copy link
Collaborator Author

Yeah, that would be great - I was just about to comment on your PR that I hope you don't take my jumping in and fixing these issues in a slightly different way as my not appreciating your contribution. There are definitely some other great fixes and doc improvements in your PR!

@drewhoener
Copy link
Contributor

Oh no offense taken at all! The renaming was mostly just because I already had the type file from a previous PR I didn't get to submit, and like you said -- it's tedious lol.
I can work in my stuff no problem though.

setFailed(id: string) {
const call = {
op: "action_result",
op: "action_result" as const,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious, why was as const necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oop. thanks for catching that. moving this inline to the invocation of callOnConnection like I did elsewhere fixes the problem in a more obvious way. using as const helped TypeScript understand which message type it was, but I should've either used a type annotation or passed it directly into the parameter

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved it inline

Copy link
Contributor

@douglascayers douglascayers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🫡

@EzraBrooks EzraBrooks force-pushed the use-enormous-union-type-for-message-types branch from fb62e70 to 8f94936 Compare November 14, 2025 21:06
@EzraBrooks EzraBrooks merged commit 2234544 into develop Nov 16, 2025
14 checks passed
@EzraBrooks EzraBrooks deleted the use-enormous-union-type-for-message-types branch November 16, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent impl of Rosbridge Protocol in Service class

5 participants